  <template>
  <div class="topic">
    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="onLoad"
      :immediate-check="false"
    >
      <div v-for="item in list" :key="item.id">
        <img :src="item.scene_pic_url" alt="" width="100%" height="270px" />
        <div class="text">
          <p>{{ item.title }}</p>
          <p>{{ item.subtitle }}</p>
          <p>{{ item.price_info }}元起</p>
        </div>
      </div>
    </van-list>
  </div>
</template>

   <script>
import { listaction } from "@/api/topic/index";
export default {
  data() {
    return {
      page: 1,
      list: [],
      loading: false,
      finished: false,
    };
  },

  computed: {},
  created() {
    this.init();
  },
  mounted() {},
  methods: {
    onLoad() {
      this.init();
    },
    init() {
      listaction({
        page: this.page,
      }).then((res) => {
        console.log(res);
        this.list.push(...res.data.data);
        this.page++;
        // this.loading  数据请求完毕 loading = false
        this.loading = false;
        if (res.data.page == res.data.total) {
          this.finished = true;
        }
      });
    },
  },
};
</script>

<style scoped lang='scss'>
.text P:first-child {
  color: #333;
  font-size: 0.46667rem;
  margin-top: 0.4rem;
}

.text p:nth-child(2) {
  color: #999;
  font-size: 0.32rem;
  margin-top: 0.21333rem;
  padding: 0 0.26667rem;
}
.text p:nth-child(3) {
  color: #b4282d;
  font-size: 0.36rem;
  margin-top: 0.26667rem;
}
</style>